package com.ywjt.platformbusiness.classify.adapter;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.home.CommonModel;

import java.util.List;

public class ClassifyTypeAdapter  extends BaseQuickAdapter<CommonModel, BaseViewHolder> {

    public ClassifyTypeAdapter( @Nullable List<CommonModel> data) {
        super(R.layout.item_classify_type, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CommonModel item) {
        LinearLayout llContainer=helper.getView(R.id.llContainer);
        TextView tvTitle=helper.getView(R.id.tvTitle);
        tvTitle.setText(item.getStr());
        if (item.getSelected()){
            llContainer.setBackgroundColor(mContext.getResources().getColor(R.color.white));
            helper.getView(R.id.tvIndicter).setVisibility(View.VISIBLE);
            tvTitle.setTextColor(mContext.getResources().getColor(R.color.black));
            tvTitle.getPaint().setFakeBoldText(true);
        }else {
            helper.getView(R.id.tvIndicter).setVisibility(View.INVISIBLE);
            llContainer.setBackgroundColor(mContext.getResources().getColor(R.color.white_e));
            tvTitle.setTextColor(mContext.getResources().getColor(R.color.gray3));
            tvTitle.getPaint().setFakeBoldText(false);
        }
    }
}
